package com.future.direction.ui.activity;

import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;

import com.future.direction.R;
import com.future.direction.data.bean.ClockInBean;
import com.future.direction.di.component.AppComponent;
import com.future.direction.ui.adapter.ClockInAdapter;
import com.future.direction.ui.widget.MySharePopup;
import com.future.direction.ui.widget.MyTitleBar;

import java.util.ArrayList;

import butterknife.BindView;

/**
 * Created by xwl on 2019/11/07
 * 打卡页面
 */
public class ClockInActivity extends BaseActivity {


    @BindView(R.id.titleBar)
    MyTitleBar titleBar;
    @BindView(R.id.recycle_clock_in)
    RecyclerView recycleClockIn;
    private ArrayList<ClockInBean> clockInBeans;
    private ClockInAdapter clockInAdapter;
    private MySharePopup mySharePopup;

    @Override
    public int setLayout() {
        return R.layout.activity_clock_in;
    }

    @Override
    public void getExtras() {

    }

    @Override
    public boolean init() {
        initRecycler();
        return false;
    }

    private void initRecycler() {
        GridLayoutManager manager = new GridLayoutManager(this, 7);
        recycleClockIn.setLayoutManager(manager);
        clockInBeans = new ArrayList<>();
        for (int i = 0; i < 4; i++) {
            ClockInBean clockInBean = new ClockInBean();
            clockInBean.setClick(true);
            clockInBean.setDate("2019-11-07");
            clockInBeans.add(clockInBean);
        }
        for (int i = 0; i < 3; i++) {
            ClockInBean clockInBean = new ClockInBean();
            clockInBean.setClick(false);
            clockInBean.setDate("2019-11-07");
            clockInBeans.add(clockInBean);
        }
        clockInAdapter = new ClockInAdapter(R.layout.item_clock_in, clockInBeans);
        recycleClockIn.setAdapter(clockInAdapter);
    }

    @Override
    public void setListener() {
        //返回按钮
        backListener(titleBar);
        //分享按钮
        titleBar.setRightLayoutClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mySharePopup = new MySharePopup(ClockInActivity.this);

                mySharePopup.showPopWindow();

                mySharePopup.setWxClick(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {

                    }
                });
                mySharePopup.setFriendClick(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {

                    }
                });
                mySharePopup.setQQClick(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {

                    }
                });

            }
        });

    }

    @Override
    public void setupAcitivtyComponent(AppComponent appComponent) {

    }


}
